using System;

namespace MusicStore.Wpf.Toolkit.Commands
{
  public class CommandExecutionResult
  {
    private readonly bool mSucceded;
    private readonly Exception mException;

    private CommandExecutionResult()
    {
      mSucceded = true;
    }

    private CommandExecutionResult(Exception exception)
    {
      mSucceded = false;
      mException = exception;
    }

    public static CommandExecutionResult FromSuccess()
    {
      return new CommandExecutionResult();
    }

    public static CommandExecutionResult FromException(Exception exception)
    {
      return new CommandExecutionResult(exception);
    }

    public bool Succeded
    {
      get { return mSucceded; }
    }

    public bool Failed
    {
      get { return !mSucceded; }
    }

    public Exception Exception
    {
      get { return mException; }
    }
  }
}
